package cn.edu.tju.core.model;


import java.io.Serializable;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.*;

@MappedSuperclass
@Where(clause = "is_deleted=false")
@DynamicUpdate
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
@Data
public class BaseEntity implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    protected Long id;

    @JsonIgnore
    protected LocalDateTime createTime;
    @JsonIgnore
    protected LocalDateTime updateTime;
    @JsonIgnore
    protected Long creator;
    @JsonIgnore
    protected Long updater;
    @Column(name = "is_deleted",columnDefinition = "BOOLEAN DEFAULT FALSE")
    @JsonIgnore
    protected Boolean deleted;
}
